package fyf.com.carddesign.adapter;

import com.chad.library.adapter.base.BaseItemDraggableAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import fyf.com.carddesign.Dao.Card;
import fyf.com.carddesign.Dao.User;
import fyf.com.carddesign.R;

/**
 * 管理员卡片数据适配器
 * Created by yxz on 2017/10/25.
 */

public class CardAdapter extends BaseItemDraggableAdapter<Card, BaseViewHolder> {
    public CardAdapter(List<Card> data) {
        super(R.layout.item_card, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, Card item) {
        switch (helper.getLayoutPosition() %
                3) {
            case 0:
                helper.setImageResource(R.id.ic_iv_head, R.mipmap.head_img0);
                break;
            case 1:
                helper.setImageResource(R.id.ic_iv_head, R.mipmap.head_img1);
                break;
            default:
                helper.setImageResource(R.id.ic_iv_head, R.mipmap.head_img2);
                break;
        }
        helper.setText(R.id.ic_rl_tv_title, item.getName());//卡片名称
        helper.setText(R.id.ic_tv_content, item.getText());//卡片内容
        helper.setText(R.id.ic_tv_create_date, item.getAdd_date());//添加日期
    }
}
